`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: 
// Engineer: 
// 
// Create Date:    17:08:11 12/06/2008 
// Design Name: 
// Module Name:    frameBuffer 
// Project Name: 
// Target Devices: 
// Tool versions: 
// Description: 
//
// Dependencies: 
//
// Revision: 
// Revision 0.01 - File Created
// Additional Comments: 
//
//////////////////////////////////////////////////////////////////////////////////
module frameBuffer(
    input [15:0] memoryData,
    input clock,
    //input reset,
    input writeEnable,
	input [7:0] pixelIndex,
	 input [7:0] hPixelCount,
    output reg [15:0] pixelData = 0
    );
/*
	This frameBuffer is a 240 words register to hold 480 pixels in a row.
	the input which is the pixel data after compared comes from VGAread.
	the VGA controller read the pixel data from here.
*/
reg [15:0] VGA_RAM [1:240];
//reg [7:0] i;
always@(posedge clock)
begin
	if(writeEnable)
		VGA_RAM[pixelIndex] <= memoryData;
		pixelData <= VGA_RAM[hPixelCount];
end



endmodule
